import { app1 as request } from '@/api/request';
// 情况大屏
/**
 * @description 获取研发人员认证级别缺失情况
 * @method Get
 */
export function getEngineerLevel<R, T>() {
  return request.Get<R, T>('/app1-engineer/levellack');
}

/**
 * @description 获取研发人员各等级区县分布
 * @method Post
 */
export function getEngineerLevelarea<R, T>(level: any) {
  return request.Post<R, T>(`/app1-engineer/levelarea?level=${level}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

// 考情发布
/**
 * @description 考情导入excel文档录入数据库
 * @method Post
 */
export function examFileupload<R, T>(file: any) {
  return request.Post<R, T>('/app1-engineer/examFileupload', file, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * @description 查询所有考情信息
 * @method Get
 */
export function getAllExam<R, T>() {
  return request.Get<R, T>('/app1-engineer/examlist');
}

/**
 * @description 清空考情信息
 * @method Post
 */
export function clearExamData<R, T>() {
  return request.Post<R, T>('/app1-engineer/examclearData', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 修改考情信息
 * @method Post
 */
export function updateExam<R, T>(exam: any) {
  return request.Post<R, T>('/app1-engineer/examupdate', exam, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 删除单条考情信息
 * @method Delete
 */
export function deleteExam<R, T>(id: number) {
  return request.Delete<R, T>(`/app1-engineer/examdelete?id=${id}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 根据条件查询考情信息
 * @method Post
 */
export function getExamById<R, T>(item: any) {
  return request.Post<R, T>('/app1-engineer/examsearch', {
    headers: {
      'Content-Type': 'application/json',
    },
    params: item,
  });
}

/**
 * @description 导出考情信息excel模板
 * @method Get
 */
export function getExamExcel<R, T>() {
  return request.Get<R, T>('/app1-engineer/exportExamInfoTemplate', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    responseType: 'blob',
  });
}

// 工程师明细
/**
 * @description 导出工程师信息excel模板
 * @method Get
 */
export function getEngineerExcel<R, T>() {
  return request.Get<R, T>('/app1-engineer/exportEngineerInfoTemplate', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    responseType: 'blob',
  });
}

/**
 * @description 工程师导入excel文档录入数据库
 * @method Post
 */
export function certificationFileupload<R, T>(file: any) {
  return request.Post<R, T>('/app1-engineer/CertificationFileupload', file, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * @description 查询所有工程师数据
 * @method Get
 */
export function getCertificationList<R, T>() {
  return request.Get<R, T>('/app1-engineer/certificationlist', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 根据id查询工程师数据
 * @method Get
 */
export function certificationget<R, T>(id: number) {
  return request.Get<R, T>(`/app1-engineer/certificationget?id=${id}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 根据条件查询工程师数据
 * @method Post
 */
export function certificationsearch<R, T>(value: any) {
  return request.Post<R, T>('/app1-engineer/certificationsearch', value, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 删除工程师信息
 * @method Delete
 */
export function certificationdeleteids<R, T>(id: number[]) {
  return request.Delete<R, T>('/app1-engineer/certificationdeleteids', id);
}

/**
 * @description 编辑工程师信息
 * @method Post
 */
export function certificationupdate<R, T>(change: any) {
  return request.Post<R, T>('/app1-engineer/certificationupdate', change, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

// 工时
/**
 * @description 工时导入excel文档录入数据库
 * @method Post
 */
export function uploadEmployeehoursData<R, T>(file: any) {
  return request.Post<R, T>('/app1-engineer/EmployeeHoursFileupload', file, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * @description 根据姓名或人员编码查询研发人员明细和工时
 * @method Get
 */
export function getEngineerByKeyword<R, T>(keyword: any) {
  return request.Get<R, T>('/app1-engineer/Engineersearch', {
    params: {
      keyword,
    },
  });
}

/**
 * @description 清空工时明细
 * @method Delete
 */
export function deleteEngineerAll<R, T>() {
  return request.Delete<R, T>('/app1-engineer/Engineerdeleteall');
}

/**
 * @description 导出工时excel模板
 * @method Get
 */
export function getWorkHoursExcel<R, T>() {
  return request.Get<R, T>('/app1-engineer/exportWorkHoursTemplate', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    responseType: 'blob',
  });
}

/**
 * @description 编辑工时
 * @method Post
 */
export function updateEngineerHours<R, T>(newData: any) {
  return request.Post<R, T>('/app1-engineer/Engineerupdate', newData, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 删除工时
 * @method Delete
 */
export function deleteEngineerHours<R, T>(id: number) {
  return request.Delete<R, T>(`/app1-engineer/Engineerdelete?id=${id}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 获取全部工时
 * @method Get
 */
export function getAllEngineerHours<R, T>() {
  return request.Get<R, T>('/app1-engineer/listAll', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * @description 根据姓名或人员编码查询研发人员明细和工时
 * @method Post
 */
export function getEngineerSearch<R, T>(data: any) {
  return request.Post<R, T>('/app1-engineer/Engineersearch', data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 批量删除工时明细
 * @method Delete
 */
export function deleteChooseEngineerHours<R, T>(ids: number[]) {
  return request.Delete<R, T>('/app1-engineer/Engineerdeleteids', ids, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 工时分页查询
 * @method Post
 */
export function getEngineerHoursByPage<R, T>(currentPage: number, pageSize: number) {
  return request.Post<R, T>('/app1-engineer/Engineerpage', { currentPage, pageSize }, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 明细分页查询
 * @method Post
 */
export function getEngineerByPage<R, T>(currentPage: number, pageSize: number) {
  return request.Post<R, T>('/app1-engineer/certificationpage', { currentPage, pageSize }, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 根据id查询全部工时
 * @method Get
 */
export function getAllEngineerHoursById<R, T>(id: string) {
  return request.Get<R, T>(`/app1-engineer/getSumHour?employeeId=${id}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

// 报名
/**
 * @description 添加报名
 * @method Post
 */
export function examUserAdd<R, T>(data: any) {
  return request.Post<R, T>('/app1-engineer/examuseradd', data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 考试报名用户修改明细
 * @method Put
 */
export function examUserUpdate<R, T>(data: any) {
  return request.Put<R, T>('/app1-engineer/examuserupdate', data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}
export function getexamuserList<R, T>() {
  return request.Get<R, T>('/app1-engineer/examuserlist', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}
export function deleteExamuser<R, T>(id: number) {
  return request.Delete<R, T>(`/app1-engineer/examuser/${id}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}
export function getexamuserByPersonCode<R, T>(personCode: string) {
  return request.Get<R, T>(`/app1-engineer/examsearchByPersonCode/?personCode=${personCode}`, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}
/**
 * @description 考试报名用户新增明细
 * @method Post
 */
export function examUseradd<R, T>(data: any) {
  return request.Post<R, T>('app1-engineer/examuseradd', data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}
export function addcertification<R, T>(data: any) {
  return request.Post<R, T>('/app1-engineer/certificationadd', data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 根据组织分页查询明细
 * @method Post
 */
export function getDetailsByCompanyPage<R, T>(currentPage: number, pageSize: number, company: string) {
  const data = {
    currentPage,
    pageSize,
  };
  return request.Post<R, T>(`/app1-engineer/byCompanyPage/?company=${company}`, data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

/**
 * @description 根据组织分页查询工时明细
 * @method Post
 */
export function getHoursByCompanyPage<R, T>(currentPage: number, pageSize: number, company: string) {
  const data = {
    currentPage,
    pageSize,
  };
  return request.Post<R, T>(`/app1-engineer/byhoursCompanyPage/?company=${company}`, data, {
    headers: {
      'Content-Type': 'application/json',
    },
  });
}
